﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CodeGeneratorBootstrap.Models;

namespace CodeGeneratorBootstrap.Template.Web.Scripts
{
    public partial class MultipleSelectedJs : ITemplate
    {
        public MetaData Data { get; set; }
        public List<LookupClassModel> lookups { get; set; }
        public List<PickupListModel> pickuplist { get; set; }

        public string Filename
        {
            get { return "MultipleSelected.js"; }
        }
        public string FolderName
        {
            get { return ""; }
        }

        public bool IsGenerateOneTime { get { return true; } }
        public bool IsGenerateFolder { get { return false; } }
        public bool IsRequiredOnlyOneMember { get { return false; } }
        public GenerateStyle GenerateStyle { get { return GenerateStyle.Normal; } }


        public MultipleSelectedModel getNextLevel(MultipleSelectedModel multiModel, List<MultipleSelectedModel> groupMultiModel)
        {
            int currentId = multiModel.Id;
            var nextMulti = groupMultiModel.Where(m => m.Parent != null).Where(n => n.Parent.Id == currentId).DefaultIfEmpty().First();
            if (nextMulti != null) return nextMulti;
            else return null;
        }
    }
}
